﻿#ifndef C_STATUS_BAR_H
#define C_STATUS_BAR_H
#include <commctrl.h>
#pragma comment(lib, "comctl32.lib")

class CStatusBar
{
public:

	//创建状态栏
	inline HWND Create(LONG style, LPCTSTR lpszText, HWND hParent, UINT wID)
	{
		HWND hWnd = CreateStatusWindow(
			style,			//样式
			lpszText,		//显示在状态栏上的信息
			hParent,		//父窗口句柄
			wID				//预定义的资源ID
			);

		this->m_hStatusBar = hWnd;
		this->m_hParent = hParent;
		return hWnd;
	}

	//调整大小
	inline void Resize()
	{
		MoveWindow(this->m_hStatusBar, 0, 0, 0, 0, TRUE);
	}

	//添加栏目
	inline void AddPanel(int nPanelCount, int nPanels[])
	{
		::SendMessage(this->m_hStatusBar, SB_SETPARTS, nPanelCount, (LPARAM)nPanels);
	}

	//设置栏目文字
	inline void SetPanelText(UINT nIndex, LPCTSTR szText)
	{
		::SendMessage(this->m_hStatusBar, SB_SETTEXT, nIndex, (LPARAM)szText);
	}

private:
	HWND m_hStatusBar;
	HWND m_hParent;
};

#endif